home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -screenplay- / shareware / amigapmars / pmars.doc < prev    next >
Text File  |  1996-02-20  |  65KB  |  1,381 lines

  1.       
  2.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  3.       
  4.       
  5.       NAME
  6.            pmars - portable corewar system with ICWS'94 extensions
  7.       
  8.       SYNOPSIS
  9.            pmars [ option ... ] file1 [ file(s) ]
  10.       
  11.       DESCRIPTION
  12.            pMARS (portable Memory Array Redcode Simulator) is a corewar
  13.            interpreter  with  multi-platform  support.  pMARS currently
  14.            runs on UNIX systems, PC/DOS, VMS, Amiga  (AmigaDOS  command
  15.            line),  and  the  Mac.   pMARS  implements the ICWS'94 draft
  16.            standard, but can also be used in  ICWS'88  mode.  The  base
  17.            system  includes  a graphical core display for UNIX (curses,
  18.            X-windows), PC/linux (svgalib),  PC/DOS  and  the  Mac  (see
  19.            APPENDIX).  A  line-oriented debugger is included to help in
  20.            writing warriors for the ICWS'94 draft standard.
  21.       
  22.            pMARS runs one or more warriors written in Redcode that  are
  23.            provided  as  file(s) on the command line.  Running a single
  24.            warrior is supported for debugging. Two warriors are  pitted
  25.            against  each other for standard play, but up to 36 warriors
  26.            can be named for "multi-warrior" core war. If the warrior(s)
  27.            assemble  without  error they are loaded into the core array
  28.            and executed in round-robin mode  starting  with  the  first
  29.            warrior.   Warrior  1 is loaded starting at core position 0,
  30.            warrior 2, 3, etc., at either a random  or  fixed  position.
  31.            For fairness the starting order is rotated after each round.
  32.       
  33.       SCORE
  34.            The score is reported after all rounds have been  played.  A
  35.            round ends when either a single surviving warrior remains or
  36.            when a maximum number  of  cycles  has  elapsed.   For  each
  37.            round,  every surviving warrior is awarded points calculated
  38.            from a score formula (F).  By default,  this  is  (W*W-1)/S,
  39.            where  W is the total number of warriors participating, S is
  40.            the number of of survivors, and  "/"  is  integer  division.
  41.            Alternative  score  formulas  can  be  specified  with the =
  42.            option (see below).
  43.       
  44.            When two warriors battle, the results are reported as wins1,
  45.            wins2,  and  ties,  where wins1 and wins2 are the numbers of
  46.            rounds that each warrior won, and ties  are  the  number  of
  47.            rounds  in  which  both warriors lasted until time-out.  The
  48.            score is then:
  49.       
  50.                    warrior 1:  points = wins1 * F + ties * F
  51.                    warrior 2:  points = wins2 * F + ties * F
  52.       
  53.            F is a score formula containing  the  W  and  S  parameters.
  54.            When  more  than  two  warriors  (W)  participate in a game,
  55.            results are  reported  as  wins[1],  wins[2],  ..,  wins[W],
  56.            losses  for  each  warrior,  where  the  index indicates the
  57.       
  58.       
  59.       PMARS v0.8.5     Last change: February 10, 1996                 1
  60.       
  61.       
  62.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  63.       
  64.       
  65.            number of warriors that survived until the end (S  parameter
  66.            in  the  score formula). The total number of points for each
  67.            warrior is then calculated as:
  68.       
  69.                    points =  sum (S=1..W) (wins[S] * F)
  70.       
  71.            A few alternative score formulas:
  72.       
  73.                         10
  74.                         (W+1)/S
  75.                         (x=W-S+1)*(x+1)/2
  76.                         (S==3)*5 + (S==2)*3 + (S==1)
  77.                         (S == 1)*W + (S != 1)
  78.       
  79.       
  80.       OPTIONS
  81.            Command line options may occur anywhere on the command line.
  82.            Single-letter options without a parameter can be combined as
  83.            in -fbe. The special argument - (dash) stands  for  standard
  84.            input  (stdin).  It  can be combined with the -@ option (see
  85.            below) to signify reading options from stdin, or the  -  can
  86.            take the place of a  warrior filename, in which case warrior
  87.            code starting with a ;redcode line and ending  with  an  END
  88.            statement  is extracted from stdin. The END statement can be
  89.            omitted if the next ;redcode line  immediately  follows  the
  90.            last  instruction.  Several  warriors,  each  specified by a
  91.            separate  dash  on  the  command  line  and   bracketed   by
  92.            ;redcode/END can be piped into pMARS. #- (where # is a posi-
  93.            tive number) is a  shorthand  for  writing  this  number  of
  94.            dashes on the command line.
  95.       
  96.            -r # This options sets the number of  rounds  to  play.  The
  97.                 default  is 1. -r 0 produces assembly output (unless -b
  98.                 is specified), but does not execute the  warrior(s).  A
  99.                 maximum of 32787 rounds can be specified.
  100.       
  101.            -s # The -s option specifies the  size  of  core  memory  in
  102.                 number  of  instructions.  It defaults to 8000. Maximum
  103.                 core size is platform-dependent, but usually  at  least
  104.                 65535.
  105.       
  106.            -c # -c sets the maximum number  of  cycles  per  round.   A
  107.                 cycle  consists  of  one  execution  of each warrior. A
  108.                 round ends when either a single warrior remains execut-
  109.                 ing or when the maximum number of cycles has elapsed.
  110.       
  111.            -p # This option sets the maximum number of processes a war-
  112.                 rior can run.  The default is 8000.
  113.       
  114.            -l # This sets the maximum length of a warrior  source  file
  115.                 in  instructions.   It defaults to 100 and can be up to
  116.                 500.
  117.       
  118.       
  119.       PMARS v0.8.5     Last change: February 10, 1996                 2
  120.       
  121.       
  122.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  123.       
  124.       
  125.            -d # This option specifies the minimum distance between  the
  126.                 first instruction of each warrior. It cannot be smaller
  127.                 than the maximum length (-l option) and defaults to 100
  128.                 instructions.
  129.       
  130.            -S # The -S option sets the size of the P-space to #  cells.
  131.                 The  default  is  1/16th  of  core size if core size is
  132.                 evenly divisible by sixteen, or the next larger divisi-
  133.                 ble fraction. See also the P-SPACE section below.
  134.       
  135.            -F # This option tells the loader to install warrior 2 at  a
  136.                 fixed  address  # for round 1. This number is then used
  137.                 to seed the pseudo random number generator for all sub-
  138.                 sequent warriors and subsequent rounds.  This option is
  139.                 useful for testing different versions of a warrior with
  140.                 constant   initial  placement.   Warrior  1  is  always
  141.                 installed at address 0.
  142.       
  143.            -f   The -f option instructs  the  loader  to  use  a  fixed
  144.                 series  of  addresses for positioning warriors. This is
  145.                 done by initializing the pseudo random number generator
  146.                 with  a  checksum  value derived from the source of all
  147.                 warriors.  Thus, initial placements will still be "ran-
  148.                 dom"  from  round to round, but will be the same if the
  149.                 same warriors are run  again.  As  a  consequence,  the
  150.                 result  of  battles run with the -f option will show no
  151.                 statistical fluctuations. This options  is  useful  for
  152.                 validating ports of pMARS to new platforms and for pro-
  153.                 viding an absolute, albeit arbitrary performance  meas-
  154.                 ure  for  warriors.  The  -F and -f option are mutually
  155.                 exclusive. If neither option is specified,  the  pseudo
  156.                 random  number generator is initialized with the system
  157.                 time.
  158.       
  159.            -e   If this  option  is  specified,  the  cdb  debugger  is
  160.                 entered immediately after loading warriors into core.
  161.       
  162.            -b   This options  runs  pMARS  in  brief  output  mode.  -b
  163.                 suppresses warrior listings after assembly.
  164.       
  165.            -k   With the -k option, pMARS uses the same  output  format
  166.                 as  the KotH program. This option enables pMARS to work
  167.                 with scripts written for the KotH server.
  168.       
  169.            -8   This  options  enforces  strict  compliance  with   the
  170.                 ICWS'88  standard  and  disables  all  ICWS'94 language
  171.                 extensions, which are flagged as syntax errors  by  the
  172.                 assembler. Since ICWS'94 is a superset of ICWS'88, this
  173.                 options is not necessary to run ICWS'88 warriors.
  174.       
  175.            -o   When this option is  given,  pMARS  reports  scores  in
  176.                 decreasing order rather than in the order warriors were
  177.       
  178.       
  179.       PMARS v0.8.5     Last change: February 10, 1996                 3
  180.       
  181.       
  182.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  183.       
  184.       
  185.                 named on the command line. This is  mostly  useful  for
  186.                 multi-warrior play.
  187.       
  188.            -V   The  assembler  generates  verbose  output  with   this
  189.                 option. This is only useful for debugging.
  190.       
  191.            -v   This option sets the display  mode  for  UNIX  and  DOS
  192.                 display versions (see APPENDIX).
  193.       
  194.            -@ <fn>
  195.                 pMARS continues reading options and filenames from  the
  196.                 parameter  file  <fn>.  If  <fn> is a - (dash) standard
  197.                 input is parsed. Comments in the parameter  file  start
  198.                 with a semicolon.
  199.       
  200.            -= <string>
  201.                 The = (equal) option allows you  to  specify  a  custom
  202.                 score  formula (see SCORE). The formula may contain the
  203.                 standard arithmetic and logical operators (as in the  C
  204.                 language),  as well as the parameters W (number of war-
  205.                 riors participating) and S (number of warriors  surviv-
  206.                 ing this round). You need to enclose the formula string
  207.                 with quotes if it contains spaces or characters  inter-
  208.                 preted by the operating system.
  209.       
  210.            -Q # The "query" option is intended for use in scripts  that
  211.                 run  pMARS  in batch mode. Depending on the number code
  212.                 following -Q, the program returns an informative number
  213.                 as  the  exit  status.  "pmars -Q 1000" e.g. will cause
  214.                 pMARS to exit with a code that spells out  the  program
  215.                 version.  More  on  -Q  arguments and exit codes can be
  216.                 found in the ADDENDUM.
  217.       
  218.            $    The $ (dollar) parameter is not preceded by a dash  and
  219.                 cannot  be  grouped  with  other options. It terminates
  220.                 reading command line parameters and is used in  parame-
  221.                 ter  files or input streams (-@ fn). The $ is necessary
  222.                 if you want to combine two  or  more  of  command  line
  223.                 parameters,  warrior  code and cdb commands in the same
  224.                 input stream or file. Below an example of such  a  com-
  225.                 bined input file:
  226.       
  227.                          ;Below the command line parameters:
  228.                          -r 10 -beF 1000 2- $
  229.                          ;redcode
  230.                          ;name Imp 1
  231.                          ;assert 1
  232.                          mov 0,1
  233.                          end
  234.                          ;redcode
  235.                          ;name Imp 2
  236.                          ;assert 1
  237.       
  238.       
  239.       PMARS v0.8.5     Last change: February 10, 1996                 4
  240.       
  241.       
  242.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  243.       
  244.       
  245.                          mov 0,2
  246.                          mov 0,2
  247.                          end
  248.                          !! cdb commands follow:
  249.                          sk 1000
  250.                          reg
  251.                          quit
  252.       
  253.       
  254.       X-WINDOWS OPTIONS
  255.            The X-Windows display version of pMARS has these  additional
  256.            command line options:
  257.       
  258.            -display <string>
  259.                 Expects a string specifying the display where the  win-
  260.                 dow should appear.  Following X standards, this display
  261.                 specification       has       a        format        of
  262.                 hostname.domain:display.screen  where  the  part before
  263.                 the colon is the standard internet  host  specification
  264.                 and  display  and  screen  are  integers.   The  screen
  265.                 specification can be omitted. For an example,  consider
  266.                 you    are    working    at   an   X   terminal   named
  267.                 ncd13.complang.tuwien.ac.at and remotely logged  in  at
  268.                 host stud1.tuwien.ac.at where the binary of pmars lies,
  269.                 you can use the following command line
  270.       
  271.              stud1$ pmars -display ncd13.complang.tuwien.ac.at:0 -b aeka.red aeka.red
  272.              and the window will appear at you local screen.
  273.       
  274.            -geometry <string>
  275.                 Lets you specify the initial size and position  of  the
  276.                 window.  The  format  is  widthxheight+x+y where width,
  277.                 height, x, y are integers and + may be replaced  by  -.
  278.                 Either  of  the two parts (widthxheight or +x+y) may be
  279.                 omitted. This overrides the -v  switch  concerning  the
  280.                 window   geometry.   As  an  example,  pmars  -geometry
  281.                 600x400+30+100 ....  will open a window of 600  by  400
  282.                 pixels   at   the   screen  position  (30,100).   pmars
  283.                 -geometry 1024x768 ... creates  a  window  of  1024x768
  284.                 pixels and pmars -geometry -20+300 ... creates a window
  285.                 with standard size with its left upper corner at  posi-
  286.                 tion  (-20,300),  i.e.  out  of  the  left  side of the
  287.                 screen.
  288.       
  289.            -fn <string>
  290.                 The string following this argument specifies the X font
  291.                 to  use.  By  default, a terminal font is used. If this
  292.                 font can't  be  found,  "fixed"  is  used  for  a  font
  293.                 ("fixed"  should  be  present at every X installation).
  294.                 Use the command 'xlsfonts' to get a  listing  of  fonts
  295.                 that  can be used at your X server. 'xfontsel' provides
  296.                 a comfortable way to select  a  font.  "fixed"  is  the
  297.       
  298.       
  299.       PMARS v0.8.5     Last change: February 10, 1996                 5
  300.       
  301.       
  302.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  303.       
  304.       
  305.                 fallback  if  the specified font can't be found.  It is
  306.                 strongly recommended to use a fixed pitch font.
  307.       
  308.            The argument of the -v  display  option  has  an  additional
  309.            fourth  digit  in  the  X-Windows  version:  0 (the default)
  310.            enables the color display, 1 the grayscale, and 2 the  black
  311.            and white display (e.g. -v 1033 for the grayscale display).
  312.       
  313.       REDCODE
  314.            pMARS implements an extension of the proposed ICWS'94  stan-
  315.            dard. The new instruction modifiers .A,.B,.AB,.F,.X, and .I,
  316.            the arithmetic instructions MUL, DIV and  MOD,  as  well  as
  317.            post-increment  indirect (>) are supported.  pMARS currently
  318.            does not implement read/write ranges, although they  may  be
  319.            added in future versions.
  320.       
  321.            Version 0.5 of pMARS adds  support  for  three  experimental
  322.            opcodes  that  are  currently  not  included  in the ICWS'94
  323.            draft:
  324.       
  325.            SEQ (Skip if EQual): this  is  a  synonym  for  CMP  and  is
  326.            included  mainly  for  clarity (future versions of pMARS may
  327.            implement SEQ as a  "predefined  EQU"  rather  than  a  true
  328.            opcode).
  329.       
  330.            SNE (Skip if Not Equal): the opposite of SEQ.
  331.       
  332.            NOP (No OPerations): do nothing.
  333.       
  334.            Version 0.6 adds three new indirect  addressing  modes  that
  335.            use  the  A-field  instead of the B-field as the pointer for
  336.            indirection:
  337.       
  338.            * - indirect using A-field
  339.       
  340.            { - predrecement indirect using A-field
  341.       
  342.            } - postincrement indirect using A-field
  343.       
  344.            The new P-space instructions of version  0.8  are  discussed
  345.            under separate heading below.
  346.       
  347.            The assembler also supports  multi-line  EQU  statements,  a
  348.            feature not included in the current ICWS'94 draft.  The for-
  349.            mat for multi-line EQUates is
  350.       
  351.                     <label> EQU <line1>
  352.                             EQU <line2>
  353.                             [...]
  354.                             EQU <lineN>
  355.       
  356.            <label>  in  the  warrior  source  is  replaced  by  <line1>
  357.       
  358.       
  359.       PMARS v0.8.5     Last change: February 10, 1996                 6
  360.       
  361.       
  362.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  363.       
  364.       
  365.            <newline>  <line2>  <newline>  [....]  lineN. In contrast to
  366.            KotH, pmars EQUs substitute arbitrary  text,  and  not  just
  367.            expressions.     EQU    expressions   are   not   implicitly
  368.            parenthesized.
  369.       
  370.            pMARS features the non-standard FOR  text-repetition  macro.
  371.            This  macro repeats the text between FOR and ROF a specified
  372.            number of times:
  373.       
  374.                 <labels> <counter> FOR <times>
  375.                                    [..]
  376.                                    ROF
  377.       
  378.            <times> is an expression specifying  the  number  of  expan-
  379.            sions;  it  may  contain  EQUates and labels as long as they
  380.            have been defined before the FOR/ROF  block.   <counter>  is
  381.            the  last  label before the FOR word, but not necessarily on
  382.            the same line.  It is expanded to 01,  02,  ..,  <times>  in
  383.            each  repetition.  The  optional  <labels>  label  the first
  384.            instruction after FOR expansion. An example:
  385.       
  386.                         ORG start
  387.                 start
  388.                 sp      FOR 2
  389.                 a&sp        SPL a&sp
  390.                             JMP a&sp
  391.                         ROF
  392.       
  393.                 becomes after expansion
  394.       
  395.                 start
  396.                 a01     SPL a01
  397.                         JMP a01
  398.                 a02     SPL a02
  399.                         JMP a02
  400.       
  401.            The symbol & concatenates 'a' and 01, 02  to  form  a  valid
  402.            label.   EQU expansion and FOR/ROF processing is done in the
  403.            same pass.  It is therefore possible to write
  404.       
  405.                 dest01  EQU 500
  406.                 dest02  EQU 1000
  407.                 dest03  EQU 1500
  408.       
  409.                 idx     FOR 3
  410.                             MOV src,dest&idx
  411.                             MOV src+1,dest&idx
  412.                         ROF
  413.       
  414.                 src     MOV <-1,<-1
  415.                         JMP src,<-2
  416.       
  417.       
  418.       
  419.       PMARS v0.8.5     Last change: February 10, 1996                 7
  420.       
  421.       
  422.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  423.       
  424.       
  425.            Using predefined EQUates  (see  below)  it  is  possible  to
  426.            define  adaptive  FOR/ROF blocks. The next example fills the
  427.            remainder of the warrior (up to MAXLENGTH lines) with  decoy
  428.            instructions:
  429.       
  430.                     FOR MAXLENGTH-CURLINE
  431.                         DAT 1,1
  432.                     ROF
  433.       
  434.            Since true logical expressions have a value of "1" and false
  435.            expressions  a  value  of  "0",  you can write conditionally
  436.            assembled code enclosed by FOR/ROF:
  437.       
  438.                     FOR CORESIZE == 8000
  439.                     <some code>
  440.                     ROF
  441.       
  442.                     FOR CORESIZE != 8000
  443.                     <other code>
  444.                     ROF
  445.       
  446.            pMARS uses KotH-style ;name and ;author comments to describe
  447.            warriors.   If a line starting with ;redcode is present, all
  448.            text preceding it is ignored. This makes it possible to  run
  449.            posted  warriors  without removing mail headers and descrip-
  450.            tive text.  The ;version, ;strategy and other comments  men-
  451.            tioned in the ICWS'94 draft are currently not used.
  452.       
  453.            As another "non-standard" extension,  the  assembler  prede-
  454.            fines  the  following  run-time  variables:  CORESIZE,  MAX-
  455.            PROCESSES, MAXCYCLES, MAXLENGTH,  MINDISTANCE,  ROUNDS,  and
  456.            PSPACESIZE.  They can be used in your Redcode as though they
  457.            were defined by EQUs like
  458.       
  459.                     CORESIZE     EQU 55440  ;current value of -s parameter
  460.                     MAXPROCESSES EQU 10000  ;current value of -p parameter
  461.                     [etc.]
  462.       
  463.            The run-time variable CURLINE holds the current  instruction
  464.            number  offset  from the first instruction. WARRIORS is ini-
  465.            tialized with the number of warriors specified on  the  com-
  466.            mand line.
  467.       
  468.            pMARS supports the ;assert directive as a  way  of  checking
  469.            whether  a  warrior  is  run  under  the  parameters  it was
  470.            designed for. If the expression following ;assert  evaluates
  471.            to  "0"  (false), assembly is aborted with an error message.
  472.            If an ;assert is missing, a warning is issued. Examples:
  473.       
  474.                     ;assert CORESIZE == 55440 && MAXLENGTH >= 200
  475.                     ;assert !(CORESIZE % 4)  ; is multiple of 4
  476.                     ;assert 1 ; if warrior works under all settings
  477.       
  478.       
  479.       PMARS v0.8.5     Last change: February 10, 1996                 8
  480.       
  481.       
  482.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  483.       
  484.       
  485.            The run-time variable VERSION holds the current  pMARS  ver-
  486.            sion  (e.g. "60" is v0.6.0) and is useful in ;assert expres-
  487.            sions.
  488.       
  489.            With the -8  option,  pMARS  is  fully  ICWS'88  compatible,
  490.            except that a comma is required between operands. Extensions
  491.            like predefined and multi-line EQUs  and  FOR/ROF  are  sup-
  492.            ported even in ICWS'88 mode.
  493.       
  494.            A full treatment of corewar and  ICWS'94  in  particular  is
  495.            beyond the scope of this document. General information about
  496.            corewar as  well  as  the  ICWS'94  draft  is  available  by
  497.            anonymous FTP from soda.berkeley.edu in pub/corewar.
  498.       
  499.       P-SPACE
  500.            Originating from discussions on  rec.games.corewar,  P-space
  501.            is  an attempt at making warriors more "intelligent" by giv-
  502.            ing them a memory.   P-space,  short  for  "private",  "per-
  503.            manent"  or  "priviledged"  space  is a memory area separate
  504.            from core whose contents  is  not  cleared  between  rounds.
  505.            Every  warrior has its own P-space for gathering information
  506.            about the opposing warrior, but there  is  a  provision  for
  507.            sharing P-space in team play (see below).
  508.       
  509.            P-space cells contain values in the range 0..CORESIZE-1. The
  510.            number  of P-space cells can be adjusted with the -S command
  511.            line option; by default, P-space size is 1/16th of CORESIZE.
  512.            This number is available to warriors as the predefined vari-
  513.            able PSPACESIZE.  pMARS updates P-space cell 0 at the begin-
  514.            ning  of each round with the result of the previous round: 0
  515.            signifies a loss in the previous round, a number larger than
  516.            zero  means  that  the warrior survived until the end of the
  517.            round, the value indicating the number of  surviving  warri-
  518.            ors. That is, a value of "1" means that the warrior survived
  519.            by itself (a "win" in a two-warrior battle), a value of  "2"
  520.            that  two  warriors  lasted  until the end (a "tie" in a two
  521.            warrior battle), etc..  In the first round, P-cell 0 is  set
  522.            to  -1  (actually  CORESIZE-1)  to indicate that there is no
  523.            previous result.
  524.       
  525.            There are two new instructions for accessing P-space:
  526.       
  527.            LDP  (Load P-space) loads P-space cell specified by  A-value
  528.                 into core at B-address.
  529.       
  530.            STP  (Store P-space) stores A-value into P-space cell speci-
  531.                 fied by B-value.
  532.       
  533.            It is important to note that P-space cells are refered to by
  534.            A/B-values  as opposed to A/B-addresses. As an example, "STP
  535.            #9,#1" stores number 9 in P-cell 1.
  536.       
  537.       
  538.       
  539.       PMARS v0.8.5     Last change: February 10, 1996                 9
  540.       
  541.       
  542.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  543.       
  544.       
  545.            Since all P-space access is only via these two instructions,
  546.            it  takes too much time and space to use P-space for working
  547.            variables where they would be safe from  the  opposing  war-
  548.            rior. P-space was made deliberately hard to access, unlike a
  549.            set of general purpose registers.
  550.       
  551.            P-space can also be used for communication between  warriors
  552.            belonging to a team in multi-warrior core war. To allow com-
  553.            munication, P-space has to be declared as "shared".  You  do
  554.            this by including the PIN pseudo-opcode in your source:
  555.       
  556.            PIN  (P-space Identification Number) has a single  numerical
  557.                 argument.  If  two  or more participating warriors have
  558.                 the same PIN argument, they share the same P-space.  If
  559.                 the  PIN  pseudo-opcode  is  missing  from  a warrior's
  560.                 source, its P-space is strictly private. The PIN  argu-
  561.                 ment  is  not normalized to [0..CORESIZE-1] before com-
  562.                 parison. "PIN 0" and "PIN CORESIZE" are  therefore  not
  563.                 the same.
  564.       
  565.            P-cell #0 holding the result of the  last  round  is  exempt
  566.            from  sharing,  i.e.   every  warrior has its own last round
  567.            cell even though the rest of its P-space may be shared.
  568.       
  569.       CDB DEBUGGER
  570.            Cdb is a line-oriented debugger. It  is  invoked  either  by
  571.            specifying the -e option (enter cdb immediately), by includ-
  572.            ing debugging commands in the warrior source, or by  hitting
  573.            Ctrl-C  during the simulation.  The debugger is also entered
  574.            whenever a warrior terminates ("post-mortem")  if  execution
  575.            was  started  with the go command.  cdb is very powerful and
  576.            has an overwhelming number of  commands.  You  may  want  to
  577.            start  with  only the most often used commands: step (single
  578.            step execution), go (execute until breakpoint),  list  (look
  579.            at  core),  trace  and untrace (set and remove breakpoints),
  580.            and go on to more complex ones later.
  581.       
  582.            The following commands are available at the cdb prompt; com-
  583.            mands can be abbreviated to the first unambiguous substring.
  584.       
  585.            <Enter>
  586.                 repeats the last command issued at the cdb prompt.
  587.       
  588.            help displays a brief command summary.
  589.       
  590.            progress
  591.                 displays the status of the current game in progress.
  592.       
  593.            registers
  594.                 displays the current state of the simulator,  including
  595.                 program counters and task queues.
  596.       
  597.       
  598.       
  599.       PMARS v0.8.5     Last change: February 10, 1996                10
  600.       
  601.       
  602.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  603.       
  604.       
  605.            go   runs the simulator until an instruction whose trace bit
  606.                 is set is executed. If there are no traced instructions
  607.                 go returns to the post-mortem debugger.
  608.       
  609.            step executes the next instruction in  the  task  queue  and
  610.                 returns to the cdb prompt.
  611.       
  612.            continue
  613.                 returns to the simulator to complete the  game  without
  614.                 interruptions.
  615.       
  616.            thread
  617.                 is similar to step except that only  the  current  task
  618.                 thread is traced.
  619.       
  620.            skip [count]
  621.                 executes the next [count]  instructions  in  the  queue
  622.                 silently before returning to the cdb prompt.
  623.       
  624.            execute [address]
  625.                 resets  the  task  queue  of  the  current  warrior  to
  626.                 [address]  and  executes it. This is useful in conjunc-
  627.                 tion with edit.
  628.       
  629.            quit aborts pMARS and returns to the OS prompt.
  630.       
  631.            trace [range]
  632.                 sets the trace bit of the specified address or  address
  633.                 range.
  634.       
  635.            untrace [range]
  636.                 clears the  trace  bit  of  the  specified  address  or
  637.                 address range.
  638.       
  639.            moveable on|off
  640.                 specifies whether the trace bit is copied by the  MOV.I
  641.                 instruction. The default is on.
  642.       
  643.            list [range]
  644.                 displays the specified range of core addresses,  a  set
  645.                 trace  bit  is  indicated by 'T'.  Unmodified addresses
  646.                 (DAT.F 0,0) are shown as blank.
  647.       
  648.            edit [range]
  649.                 allows modifying  core.  The  specified  addresses  are
  650.                 edited  by  typing  in  new instructions. Typing one or
  651.                 more spaces leaves the  core  address  unchanged,  just
  652.                 hitting  <return>  repeats the last input, and a syntax
  653.                 error aborts the edit. The full Redcode syntax  includ-
  654.                 ing  labels and (multi-line) EQUates can be used. Label
  655.                 and EQUate definitions remain in effect until the  pro-
  656.                 gram  terminates.   The  edit  command  is  useful  for
  657.       
  658.       
  659.       PMARS v0.8.5     Last change: February 10, 1996                11
  660.       
  661.       
  662.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  663.       
  664.       
  665.                 modifying warriors and trying out  single  instructions
  666.                 without having to exit and restart pMARS.
  667.       
  668.            fill [range]
  669.                 is similar to edit. Instructions in the specified range
  670.                 are  replaced  by  one  typed  in instruction. Entering
  671.                 DAT.F 0,0 ,e.g. clears the address range.
  672.       
  673.            search [pattern]
  674.                 searches core instructions for a text  pattern  in  the
  675.                 forward  direction. The next instruction matching [pat-
  676.                 tern] is displayed. The  search  includes  the  address
  677.                 number  and  trace  symbol  (T),  is  case-  and space-
  678.                 insensitive and may  contain  wildcards:  *  (asteriks)
  679.                 matches  any  number  of  characters; ? (question mark)
  680.                 matches exactly one character. E.g. "search ," searches
  681.                 for  the  next  non-blank  address;  "search dat*, ?0t"
  682.                 searches for the next DAT instruction  that  is  traced
  683.                 and has a zero B-operand value, regardless of modifier,
  684.                 A-operand and B-mode.
  685.       
  686.            write [file]
  687.                 opens a file for logging subsequent cdb output to.  The
  688.                 logfile is closed by issuing write without an argument.
  689.       
  690.            echo [string]
  691.                 is used mostly inside macros. [string] is echoed to the
  692.                 screen followed by <newline>.
  693.       
  694.            remark [string]
  695.                 is ignored by cdb and can therefore be used to  comment
  696.                 macros.
  697.       
  698.            cls  clears the screen. The  no-display  UNIX  version  does
  699.                 this  by  echoing  an  ANSI  escape  sequence;  if this
  700.                 doesn't work for you, you need  to  change  the  CLRSCR
  701.                 string  in  config.h and recompile.  clear is a synonym
  702.                 for cls .
  703.       
  704.            display clear|on|off|nnn
  705.                 (available in display versions  only)  allows  clearing
  706.                 the  core  display  (display  clear)  or  changing  the
  707.                 display mode.  display on changes the  display  to  the
  708.                 default mode, display off (same as display 0 ) suspends
  709.                 all display updates, and display nnn , where nnn is a 1
  710.                 to 3-digit number, sets the display to this mode. "nnn"
  711.                 is interpreted like the parameter  to  the  -v  command
  712.                 line option (see APPENDIX).
  713.       
  714.            switch [1|2]
  715.                 (available in display versions only) makes the left (1)
  716.                 or  right  (2)  panel the current panel for cdb output.
  717.       
  718.       
  719.       PMARS v0.8.5     Last change: February 10, 1996                12
  720.       
  721.       
  722.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  723.       
  724.       
  725.                 Without a number argument switch changes to  the  other
  726.                 panel.  If the right panel doesn't exist (initially, or
  727.                 after close, see below), it is created
  728.       
  729.            close
  730.                 (available in display versions only) closes  the  right
  731.                 cdb  panel  (if  it  exists)  and  makes the left panel
  732.                 fullscreen.
  733.       
  734.            calc expr1[,expr2]
  735.                 is a command line calculator. Since calc has  no  side-
  736.                 effects  other  than echoing the result of expression 1
  737.                 (and expression 2 if provided). In the context  of  cdb
  738.                 macros it is also used to assign values to the register
  739.                 variables 'c' through 'z'.
  740.       
  741.            macro [name][,file]
  742.                 loads, executes or lists macros. A macro expands to one
  743.                 line  of  cdb commands separated by the tilde character
  744.                 (~) (a so-called command chain, see below).   The  com-
  745.                 mand macro name executes the macro "name"; if "name" is
  746.                 left out, all currently available  macros  are  listed.
  747.                 macro  name,file  loads  macro  definitions  from  file
  748.                 "file" and executes macro "name"; again, if  "name"  is
  749.                 missing,  only a listing is produced. Macro definitions
  750.                 are appended to the list of previously  loaded  defini-
  751.                 tions  or  replace a previously loaded macro definition
  752.                 with the same name. If you are  trying  to  execute  or
  753.                 list  macros,  but  no macros have been loaded yet, the
  754.                 default macro file "pmars.mac" is loaded automatically.
  755.                 The special macro file "user" can be specified to input
  756.                 macro definitions directly  from  the  keyboard.  Macro
  757.                 definitions  consist  of  a macro name, followed by the
  758.                 equal sign, followed by a command (chain).   The  macro
  759.                 name  can  consist of any printable character excluding
  760.                 <space> and comma; the equal sign is  only  allowed  at
  761.                 the end of a macro name.  Individual macro lines have a
  762.                 limit of 80 characters, but macro  calls  inside  macro
  763.                 expansions  are allowed.  Cdb can hold up to 200 macros
  764.                 in memory.  See also the section on cdb macro  program-
  765.                 ming below.
  766.       
  767.            if <expression>
  768.                 controls execution of commands  in  macros  or  command
  769.                 chains.  If  <expression>  evaluates  to zero, the next
  770.                 command block is skipped. A command block  consists  of
  771.                 either  a  single  command  or  any  number of commands
  772.                 bracketed by !! (loop start) and ![e]  (loop  end,  see
  773.                 section  on macro programming below).  <expression> may
  774.                 contain C-style comparison and boolean  operators  (see
  775.                 below).  An if immediately preceeding a loop end (![e])
  776.                 can skip out of the loop.
  777.       
  778.       
  779.       PMARS v0.8.5     Last change: February 10, 1996                13
  780.       
  781.       
  782.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  783.       
  784.       
  785.            reset
  786.                 is used inside macros in conjunction with  if  to  ter-
  787.                 minate  macro  execution,  e.g. inside an infinite loop
  788.                 (...~if A==0~reset~...~!).
  789.       
  790.            pqueue [1|2|..|off]
  791.                 switches cdb into "process queue mode". In  this  mode,
  792.                 list,  edit  and  fill  operate  on  the  process queue
  793.                 instead of the core array, i.e. you can view and modify
  794.                 the  process queue as easily as the core array. This is
  795.                 especially  useful  for  debugging  complicated  multi-
  796.                 process  warriors.   pqueue  without  argument uses the
  797.                 process queue of the  current  warrior.  With  argument
  798.                 1,2,..,  uses  the  process  queue  of  warrior 1,2,..,
  799.                 respectively.  pqueue off returns to normal mode.
  800.       
  801.            wqueue [off]
  802.                 stands for "warrior queue" and is  similar  to  pqueue,
  803.                 except  that  numbers  provided  as arguments for list,
  804.                 edit and fill now refer to warriors: "list 0" now shows
  805.                 the program counter of warrior 1, "list 1" that of war-
  806.                 rior 2  and  so  on.   wqueue  off  returns  to  normal
  807.                 "address mode".
  808.       
  809.            pspace [1|2|..|off]
  810.                 complements the pqueue and wqueue commands. If a number
  811.                 is  specified,  the P-space of that warrior is selected
  812.                 for viewing/editing. Without an argument,  the  P-space
  813.                 of the currently executing warrior is selected. "pspace
  814.                 off" returns to core mode.
  815.       
  816.            go, step, continue and thread  may  have  a  single  address
  817.            argument.  The program counter of the current warrior is set
  818.            to this address before execution continues.
  819.       
  820.            The range argument of the list, trace, etc. commands has the
  821.            format  <start>,<stop>.  Addresses  <start>  and  <stop> are
  822.            numbers, special symbols or  C-style  expressions  including
  823.            special symbols.  If either <start> or <stop> is omitted, it
  824.            defaults to the current address.  If both are  omitted,  the
  825.            range  of  the  last  cdb  command is used. A single address
  826.            (without the comma) acts on  only  that  address.  Addresses
  827.            starting  with  a  +  or  -  are interpreted relative to the
  828.            current address.
  829.       
  830.            Expressions may contain the arithmetic  operators  -,+,*,/,%
  831.            (modulo),  the  comparison operators ==, !=, <=, >=, and the
  832.            boolean operators &&  (AND),  ||  (OR),  and  !  (negation).
  833.            Expressions  may also include register variables C through Z
  834.            and the assignment operator =. Operator precedence  is  like
  835.            that of the C-language and may be overridden by parentheses.
  836.            Assignment, comparison and  boolean  operations  are  mostly
  837.       
  838.       
  839.       PMARS v0.8.5     Last change: February 10, 1996                14
  840.       
  841.       
  842.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  843.       
  844.       
  845.            used  with  calc  and if commands in macros, but can also be
  846.            used in Redcode operands.
  847.       
  848.            Special address symbols used in cdb commands:
  849.       
  850.             .     (dot) is the current address (displayed last).
  851.             $     (dollar) is the last core address.
  852.             A     is the A value of the current instruction.
  853.             B     is the B value of the current instruction.
  854.             PC    is the program counter of the currently executing warrior.
  855.             PC1   is the program counter of warrior 1.
  856.             PC2   is the program counter of warrior 2.
  857.             LINES is the number of lines available to the cdb display
  858.             CYCLE is the current execution cycle (counted down)
  859.       
  860.            In process queue (pq), warrior queue  (wq)  or  pspace  (ps)
  861.            mode  (see  pqueue,  wqueue,  pspace), most of these symbols
  862.            have a different meaning:
  863.       
  864.             .     (dot) is the current process number (pq),
  865.                   warrior (wq), or P-space cell (ps) which was displayed last.
  866.             $     (dollar) is the last process in the process queue (pq),
  867.                   the last warrior (wq), or the last P-space cell (ps).
  868.             A     is the A value of the instruction of the current process (pq),
  869.                   the next executing process of the current warrior (wq), or
  870.                   the P-space selector (ps, same as warrior number if unshared).
  871.             B     is the B value of the instruction of the current process (pq),
  872.                   the next executing process of the current warrior (wq), or
  873.                   the P-space selector (ps).
  874.             PC    is 0.
  875.             PC1.. are 0
  876.       
  877.            Preceding a command with the character '@' (ampersand)  will
  878.            suppress  its  screen  output,  but not output to a logfile.
  879.            Preceding a command with '&' will suppress both  screen  and
  880.            logfile  output,  which is useful if you are only interested
  881.            in the "side-effects" of a command.  Starting a command with
  882.            a  <Space>  character  suppresses  saving  it  to the "last-
  883.            command" buffer that is recalled by <Enter>.
  884.       
  885.       COMMAND CHAINS AND MACRO PROGRAMMING
  886.            Several commands can be issued on one line when separated by
  887.            the  tilde  character (~). These "command chains" are useful
  888.            for repeating long command sequences, since <Enter>  recalls
  889.            the entire chain (see the examples below).  Commands requir-
  890.            ing user intervaention (list, edit, fill)  also  read  their
  891.            input from the chain.
  892.       
  893.            The "empty command" (two consecutive tildes or  a  tilde  at
  894.            the end of the chain) repeats the last command in the chain.
  895.            A command consisting of <Space> is a  null  command  and  is
  896.            used to simulate pressing <Enter> in list, edit and fill.
  897.       
  898.       
  899.       PMARS v0.8.5     Last change: February 10, 1996                15
  900.       
  901.       
  902.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  903.       
  904.       
  905.            The exclamation mark  (!)  character  is  a  special  "chain
  906.            repetitor"  command.  The  optional expression following '!'
  907.            specifies how many times the command chain starting  at  the
  908.            beginning  of  the  line  or  the  last '!' is executed. '!'
  909.            without an expression repeats until the program terminates.
  910.       
  911.            The symbol '!!' is used for nested loops and marks the start
  912.            of  a  command  block  to  be repeated. The command block is
  913.            closed by '![expression]'  and  may  contain  other  command
  914.            blocks.  A command block immediately following an if command
  915.            is executed only if the condition is true.
  916.       
  917.            With loops, subroutines (macros calling  macros),  variables
  918.            (C..Z), expressions involving comparisons and boolean opera-
  919.            tions, and  conditional  execution  (if),  the  cdb  command
  920.            language  can  be  used  to construct complicated macros for
  921.            e.g. executing a warrior until a certain  core  address  has
  922.            changed,  controlling  the  2-panel  display,  automatically
  923.            finding the right constants for a warrior, etc. See the file
  924.            "pmars.mac" for examples.
  925.       
  926.       EXAMPLE CDB COMMANDS
  927.            list ,+20
  928.                 lists the next 20 instructions.
  929.       
  930.            trace pc-10,pc+10
  931.                 traces 21 addresses centered around the program counter
  932.                 of the currently executing warrior.
  933.       
  934.            untrace 0,$
  935.                 clears all trace bits.
  936.       
  937.            go ~ reg ~ l+a,+b
  938.                 chains these commands: execute until  the  next  traced
  939.                 address  or  end of round, display the simulator status
  940.                 and list addresses in the range A-number to B-number of
  941.                 the current instruction.
  942.       
  943.            @fill0,100~dat.f 0,0
  944.                 fills addresses 0 through 100  with  'dat.f  0,0',  not
  945.                 echoing the changed addresses to the screen.
  946.       
  947.            write trace.log~step~!
  948.                 produces a continuous execution trace by repeating step
  949.                 until  pMARS  terminates,  saving the output to logfile
  950.                 "trace.log".
  951.       
  952.            @l x=5~!!~@ed x~dat x,0~if (x=x+1)<$+1~!
  953.                 This command chain could  be  useful  for  debugging  a
  954.                 stone-type, self-modifying warrior, which is assumed to
  955.                 occupy address 0 through 4 in this example. The command
  956.                 fills  core  starting at address 5 with "dat 5,0", "dat
  957.       
  958.       
  959.       PMARS v0.8.5     Last change: February 10, 1996                16
  960.       
  961.       
  962.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  963.       
  964.       
  965.                 6,0", a.s.o., so that you can tell where a  bomb  which
  966.                 overwrites  the warrior came from. To save some typing,
  967.                 you can turn this command into a macro (foo=@l x=5~..).
  968.                 This  is how it works, step by step: Assign 5 to regis-
  969.                 ter x and make it the current address (@l x=5). Start a
  970.                 loop  (!!) and change address x to "dat x,0" (@ed x~dat
  971.                 x,0). Increment x, if x is then smaller than  the  core
  972.                 size  ($+1),  continue  looping (if (x=x+1)<$+1~!). The
  973.                 '@' in front of the list and edit  commands  suppresses
  974.                 screen output.
  975.       
  976.            @s~@4~if b<2 || b>=$-3~reset~!
  977.                 This command executes a warrior until  the  B-field  of
  978.                 address  4 points to address 0 through 5: Step and make
  979.                 address 4 the current address (@s~@4). If  the  B-field
  980.                 is  less  than  2  or  greater  than  or  equal to 7996
  981.                 (CORESIZE-1-3) stop execution,  else  continue  looping
  982.                 (if b<2 || b>=$-3~reset~!).
  983.       
  984.       SOURCE DEBUGGING DIRECTIVES
  985.            Trace bits can also be set by including  debugging  commands
  986.            in  the  warrior  source. A comment format is used to retain
  987.            compatibility with simulators that do  not  support  source-
  988.            embedded debugging commands.
  989.       
  990.            ;debug [static/off]
  991.                 This command enables/disables  all  subsequent  source-
  992.                 embedded commands.  It is used for commenting out other
  993.                 source comments.  ;debug static has the same effect  as
  994.                 the  command  moveable  off  at the cdb command prompt.
  995.                 ;debug is implicitly added in front of  every  warrior.
  996.                 The  last ;debug or ;debug static encountered specifies
  997.                 whether the trace bit is copied by a MOV.I  instruction
  998.                 or not.
  999.       
  1000.            ;trace [off]
  1001.                 ;trace starts setting  the  trace  bit  with  the  next
  1002.                 instruction  until  EOF  or  a  ;trace  off  command is
  1003.                 encountered.
  1004.       
  1005.            ;break
  1006.                 sets the trace bit of the next instruction.
  1007.       
  1008.       FUTURE DIRECTIONS
  1009.            We will be  glad  to  assist  in  porting  pMARS  to  other,
  1010.            currently unsupported platforms. This program is still under
  1011.            development and we will continue  to  enhance  functionality
  1012.            and  speed,  as  well  as  adapt  to changes in the proposed
  1013.            ICWS'94 standard. If there is  demand,  future  versions  of
  1014.            pMARS will also implement read/write ranges
  1015.       
  1016.       
  1017.       
  1018.       
  1019.       PMARS v0.8.5     Last change: February 10, 1996                17
  1020.       
  1021.       
  1022.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  1023.       
  1024.       
  1025.       BUGS
  1026.            None  whatsoever  (right).   Contact  for  bug  reports  and
  1027.            suggestions  is  Stefan  Strack  (stst@vuse.vanderbilt.edu).
  1028.            Please be detailed and include a logfile of the cdb  session
  1029.            if  applicable.  Bug  reports and suggestions concerning the
  1030.            Macintosh display and interface should also be  directed  to
  1031.            Alex MacAulay (macaulay@mundil.cs.mu.oz.au).
  1032.       
  1033.       AUTHORS
  1034.            The portable MARS project was initiated after discussing the
  1035.            ICWS'94  draft  on the rec.games.corewar newsgroup. We real-
  1036.            ized that we needed a portable system to try  out  the  pro-
  1037.            posed standard and to accept, modify or reject it.  The peo-
  1038.            ple who started portable MARS and are  responsible  for  the
  1039.            base code as well as the DOS and UNIX displays are:
  1040.       
  1041.            Albert Ma (ama@athena.mit.edu)
  1042.            Nandor Sieben (nandor.sieben@asu.edu)
  1043.            Stefan Strack (stst@vuse.vanderbilt.edu)
  1044.            Mintardjo Wangsaw (wangsawm@csos.orst.edu)
  1045.       
  1046.            Alex MacAulay (macaulay@mundil.cs.mu.oz.au) wrote the Macin-
  1047.            tosh      display      version.       Martin      Maierhofer
  1048.            (m.maierhofer@ieee.org) contributed the  linux  SVGA  and  X
  1049.            windows display.  Nathan Summers (00ncsummers@bsuvc.bsu.edu)
  1050.            did the port to VMS.
  1051.       
  1052.       ACKNOWLEDGMENTS
  1053.            We thank Planar (Damien.Doligez@inria.fr)  for  expert  help
  1054.            with debugging and porting pMARS to different UNIX machines.
  1055.            We  also  appreciate   the   help   of   Chris   Lindensmith
  1056.            (lind0014@student.tc.umn.edu)    and    Pierre   Baillargeon
  1057.            (dak@info.polymtl.ca) with the initial Mac and  Amiga  ports
  1058.            respectively.   Mark  Durham (durham@ricevm.rice.edu) spear-
  1059.            headed development of the ICWS'94 draft and we thank him for
  1060.            writing the sample interpreter code included with the draft.
  1061.       
  1062.       APPENDIX
  1063.       PMARSV
  1064.            pMARSv is a DOS version  of  pMARS  with  a  graphical  core
  1065.            display. You can chose between EGA/VGA graphics or text mode
  1066.            with the -v command line options or by pressing  'v'  during
  1067.            the  game. The -v option takes a three digit argument 'xyz'.
  1068.            Digit 'x' specifies the initial  display  speed  and  ranges
  1069.            from  0 (fastest) to 7 (slowest). 'y' is the initial display
  1070.            mode: 0 for text mode, 1 for standard VGA graphics, 2 and  3
  1071.            for SVGA, 4 and 5 for EGA, and 6 for CGA graphics.
  1072.       
  1073.            The display level 'z' specifies how much is displayed:
  1074.       
  1075.            0    Display nothing.  This  greatly  speeds  up  execution,
  1076.                 especially when in graphics mode.
  1077.       
  1078.       
  1079.       PMARS v0.8.5     Last change: February 10, 1996                18
  1080.       
  1081.       
  1082.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  1083.       
  1084.       
  1085.            1    Display execution of addresses. In text mode,  a  black
  1086.                 '0'  on blue background is shown for warrior 1, a black
  1087.                 '1' on green for warrior 2, a.s.o..  Numbers  blink  in
  1088.                 white  when  a DAT instruction is executed. In graphics
  1089.                 mode, a blue  square  represents  warrior  1,  a  green
  1090.                 square  warrior  2,  a.s.o.. These colors are also used
  1091.                 for other core accesses.
  1092.       
  1093.            2    Also display write accesses. In text mode, they  appear
  1094.                 as  dots;  in graphics mode, they appear as two pixels,
  1095.                 offset diagonally.
  1096.       
  1097.            3    Also display decrements and increments. They are  shown
  1098.                 as  '+'  and  '-' in text mode and as two pixels offset
  1099.                 vertically or horizontally in graphics mode.
  1100.       
  1101.            4    Also display read accesses, which appear as small  dots
  1102.                 in text mode and as single pixels in graphics mode.
  1103.       
  1104.            The more is displayed, the slower runs the simulation.   The
  1105.            argument  for  -v  defaults to 103, i.e. speed=1, mode=text,
  1106.            level=3.
  1107.       
  1108.            The text mode display is very fast, but  contains  less  on-
  1109.            screen  information  than  the  graphics  display.  The core
  1110.            display and the cdb debugger  run  full-screen  on  separate
  1111.            display pages.
  1112.       
  1113.            In graphics mode, core and debugger share the  same  screen.
  1114.            The mouse can be used to navigate around core when debugging
  1115.            is enabled: clicking a mouse button  on  any  core  location
  1116.            lists addresses starting there. The mouse cursor follows the
  1117.            current program counter when in single step mode.
  1118.       
  1119.            In both graphics and text  mode,  the  cdb  display  can  be
  1120.            divided into two side-by-side panels. You can switch between
  1121.            panels with the switch command  (or  the  <Tab>  macro)  and
  1122.            close  the right panel with close (or the <Shft-Tab> macro).
  1123.            Extended (function keys, arrow/page keys,  ALT  keys,  etc.)
  1124.            and  control  keys  generate  macro calls at the cdb prompt;
  1125.            some  of  these  "hot  key  macros"  have  been  defined  in
  1126.            "pmars.mac";  you  can easily change them or add more with a
  1127.            text editor.  E.g. <PgDn> and <PgUp> keys  currently  invoke
  1128.            macros that scroll through core one screen at a time.
  1129.       
  1130.            A white line at the top of  the  display,  called  the  time
  1131.            meter,  indicates  the  time  required to finish the current
  1132.            simulation. The amount of time depends on the number of war-
  1133.            riors  still  alive in the arena. After a warrior dies it no
  1134.            longer needs simulation time so the required time to  finish
  1135.            the simulation becomes less. On the time meter this is indi-
  1136.            cated by a discontinuity. One can count the number  of  dead
  1137.       
  1138.       
  1139.       PMARS v0.8.5     Last change: February 10, 1996                19
  1140.       
  1141.       
  1142.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  1143.       
  1144.       
  1145.            warriors in the arena by counting the number of discontinui-
  1146.            ties on the time meter.
  1147.       
  1148.            Just below, the length of "process meters" in the  color  of
  1149.            the  warriors  they  represent  show how many processes each
  1150.            warrior has running.
  1151.       
  1152.            The following keys are available at the core display screen:
  1153.       
  1154.            0..4 selects the display level (see above).
  1155.       
  1156.            v    switches from text display to graphics display and vice
  1157.                 versa.
  1158.       
  1159.            >    increases the display speed.
  1160.       
  1161.            <    decreases the display speed. The current speed is indi-
  1162.                 cated by a red bar in graphics mode.
  1163.       
  1164.            d    enters the cdb debugger. "Debug" on the  graphics  menu
  1165.                 bar is highlighted in red inside cdb.
  1166.       
  1167.            <space>
  1168.                 (also 'r') refreshes the core display.
  1169.       
  1170.            <escape>
  1171.                 (also 'q') exits to DOS.
  1172.       
  1173.            You can define additional keys and commands associated  with
  1174.            them  by defining "key-x" macros ("x" is any printable char-
  1175.            acter). E.g.:
  1176.       
  1177.                 key-p= progress~registers~continue
  1178.       
  1179.            Function-key and other macros can also be invoked  from  the
  1180.            core display.
  1181.       
  1182.       CURSES DISPLAY
  1183.            The curses display is very similar  to  the  DOS  text  mode
  1184.            display.  There  are  separate  pages for core and debugger.
  1185.            There is a status bar at the bottom of the core display:
  1186.       
  1187.            Rave [0]: 1        Lucky 3 [1]: 3702  Cycle: 72967  R: 2/5 (0 0 1)
  1188.       
  1189.            The display symbol that  indicates  execution  is  shown  in
  1190.            brackets  after the warrior name. The number after the colon
  1191.            shows the number of processes active.  The  "2/5  (0  0  1)"
  1192.            means  that  this  is round 2 of 5; the result so far is one
  1193.            tie. Only cycle and round information is shown if more  than
  1194.            two warriors are run.
  1195.       
  1196.       
  1197.       
  1198.       
  1199.       PMARS v0.8.5     Last change: February 10, 1996                20
  1200.       
  1201.       
  1202.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  1203.       
  1204.       
  1205.            There is  no  "hot  key"  user  interface  during  the  core
  1206.            display,  but  you  can enter the debugger by hitting Ctrl-C
  1207.            and clearing the display, changing the  display  mode,  etc.
  1208.            from  within  cdb.  Only the first and third digit of the -v
  1209.            option and display  command  argument,  namely  the  display
  1210.            speed  and  level,  have  an  effect (see PMARSV above). The
  1211.            display speed setting  (0=fastest,  7=slowest)  adjusts  the
  1212.            screen  refresh rate; depending on the size of your display,
  1213.            movement in core may appear "jerky" at fast speeds.  Control
  1214.            keys at the cdb prompt generate a macro call like in the DOS
  1215.            versions.
  1216.       
  1217.            If you redirect standard input (by supplying a '-'  filename
  1218.            or parameter file), all interactive input is disabled.
  1219.       
  1220.       MACINTOSH DISPLAY
  1221.            MacpMARS is a Macintosh version of pMARS  with  a  graphical
  1222.            core  display  and standard Macintosh user interface. It has
  1223.            two windows, the Core window and Text window. The display of
  1224.            the  core  uses  four  patterns  for each warrior (black and
  1225.            white backgrounds respectively) to show what is happening in
  1226.            the core:
  1227.       
  1228.            '/' when the core location is written to  (including  incre-
  1229.            menting and decrementing);
  1230.       
  1231.            '\' when a process has died at the core location;
  1232.       
  1233.            '-' when a process has executed at the core location;
  1234.       
  1235.            '|' when a process is waiting to execute at the  core  loca-
  1236.            tion.
  1237.       
  1238.            If you click on a core location in the Core window  while  a
  1239.            battle  is  being run, the contents will be displayed in the
  1240.            Text window.
  1241.       
  1242.            Two warriors can be in memory at any one time. To assemble a
  1243.            warrior  choose "Choose Warrior n..." from the File menu. To
  1244.            remove the warrior from memory choose "Remove Warrior n...".
  1245.            You  can  modify  the  settings  used  by  choosing "Prefer-
  1246.            ences..." (this can only be done when  no  battle  is  being
  1247.            run).  Alternatively,  you can type in a command line in the
  1248.            same way as if you were typing from a unix prompt (if you're
  1249.            used  to  that sort of thing) by choosing "Command Line...".
  1250.            The Edit menu is just the normal Macintosh Edit menu and can
  1251.            be  used  to  cut and paste text in the Text window and dia-
  1252.            logs.  The  items  in  the  Play  menu  are   fairly   self-
  1253.            explanatory:  "Go"  starts  (or  continues) a battle; "Step"
  1254.            executes one instruction and  enters  the  debugger;  "Halt"
  1255.            halts the battle and enters the debugger; "Abort" aborts the
  1256.            battle. The Window menu is used to show and bring either  of
  1257.       
  1258.       
  1259.       PMARS v0.8.5     Last change: February 10, 1996                21
  1260.       
  1261.       
  1262.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  1263.       
  1264.       
  1265.            the two windows to the front of the screen.
  1266.       
  1267.            The cdb commands display, switch and close are not available
  1268.            in MacpMARS.
  1269.       
  1270.            Note: to use very large core sizes (up to about  65000)  and
  1271.            process limits you may need to increase the memory partition
  1272.            for MacpMARS.  To do this, choose "Get Info" from  the  File
  1273.            menu  in  the  Finder  and  set the preferred memory size to
  1274.            about 1200K.
  1275.       
  1276.       EXIT CODES
  1277.            The following is mainly useful for people who write  scripts
  1278.            or  batch  files  for  pMARS.  Upon normal exit, the program
  1279.            returns 0. Below is a listing  of  what  the  abnormal  exit
  1280.            codes  mean.  Your operating system may not support negative
  1281.            exit codes; in this case you have to convert  the  value  to
  1282.            its unsigned counterpart.
  1283.       
  1284.                -4      graphics error
  1285.                -3      trying to execute 80386 code on a lesser processor
  1286.                -2      memory allocation error
  1287.                -1      serious program logic error, contact developers
  1288.                 1      file not found
  1289.                 2      command line error
  1290.                 3      assembly error
  1291.                 4      user aborted program
  1292.            The exit codes of the VMS version conform to the  VMS  stan-
  1293.            dard.  The  -Q  (Query)  command  line  option (see OPTIONS)
  1294.            allows you to customize the pMARS exit code. E.g. "pmars  -Q
  1295.            1000"  returns the current pMARS version. Below the -Q argu-
  1296.            ments and what the resulting exit codes mean.
  1297.       
  1298.            1..W exit code is score of this warrior, 1: first in  result
  1299.                 output,  2:  second,  a.s.o..  If the -o option is also
  1300.                 given, "1" gives the score of the highest scoring  war-
  1301.                 rior, etc..
  1302.       
  1303.            101..1W
  1304.                 returns the number of this warrior in the  result  out-
  1305.                 put.  Usually  -Q 101 returns 1, -Q 102 returns 2 etc.,
  1306.                 so this is not very useful. If you also specify the  "-
  1307.                 o"  (order results) option, -Q 101 returns the position
  1308.                 of the highest scoring warrior on the command line,  -Q
  1309.                 110  the  position of the 10th highest scoring warrior,
  1310.                 etc..
  1311.       
  1312.            1000 exit code is the pMARS version in the  same  format  as
  1313.                 the predefined VERSION variable.
  1314.       
  1315.            1001 returns the pMARS "variant": 0 if the program was  com-
  1316.                 piled  with  the  SERVER  option  (no debugger), 1 with
  1317.       
  1318.       
  1319.       PMARS v0.8.5     Last change: February 10, 1996                22
  1320.       
  1321.       
  1322.       PMARS(6)                 GAMES AND DEMOS                 PMARS(6)
  1323.       
  1324.       
  1325.                 debugger but without display, 2 with debugger and  core
  1326.                 display.
  1327.       
  1328.            1002 returns  a  combination   of   version   and   variant:
  1329.                 10*variant+version.
  1330.       
  1331.            1003 the exit code is the core address size in bytes.  On  a
  1332.                 32-bit  CPU,  this  is  sizeof(int),  usually  4.  With
  1333.                 SMALLMEM   compilation,   core    address    size    is
  1334.                 sizeof(unsigned short), usually 2.
  1335.       
  1336.            2000 returns how many warriors share one or more P-spaces. A
  1337.                 value of 4, e.g.  means that either four warriors share
  1338.                 one P-space, or that two pairs of  warriors  share  two
  1339.                 P-spaces.
  1340.       
  1341.       
  1342.       
  1343.       
  1344.       
  1345.       
  1346.       
  1347.       
  1348.       
  1349.       
  1350.       
  1351.       
  1352.       
  1353.       
  1354.       
  1355.       
  1356.       
  1357.       
  1358.       
  1359.       
  1360.       
  1361.       
  1362.       
  1363.       
  1364.       
  1365.       
  1366.       
  1367.       
  1368.       
  1369.       
  1370.       
  1371.       
  1372.       
  1373.       
  1374.       
  1375.       
  1376.       
  1377.       
  1378.       
  1379.       PMARS v0.8.5     Last change: February 10, 1996                23
  1380.       
  1381.